package com.toolkit.config;

import com.toolkit.interceptor.LoginInterceptor;
import com.toolkit.interceptor.RequestInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
//    @Autowired
//    private RepeatSubmitInterceptor repeatSubmitInterceptor;
    @Autowired
    private RequestInterceptor requestInterceptor;
    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(requestInterceptor).addPathPatterns("/**").excludePathPatterns("/static/**");
//        registry.addInterceptor(repeatSubmitInterceptor).addPathPatterns("/**").excludePathPatterns("/static/**");
        registry.addInterceptor(loginInterceptor).addPathPatterns("/**").excludePathPatterns("/static/**");
        WebMvcConfigurer.super.addInterceptors(registry);
    }

}